<template>
        <el-menu
        :style="{width: !isCollapse ? '230px' :'64'}"
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="aside-container"
        text-color="#fff"
        @open="handleOpen"
        @close="handleClose"
        :collapse="isCollapse "
        :default-active="active"
      >
      <p class="logo-lg">{{ isCollapse ? 'DIDI' :'DIDI陪诊' }}</p>
      <!-- 自定义的树形菜单组件 -->
       <TreeMenu :index="1" :menuData="menuData" />
      </el-menu>
</template>

<script setup lang="ts">
import TreeMenu from '../components/treeMenu.vue';
import { useRouter } from 'vue-router'; 
import { reactive,computed} from 'vue';
import { useMenuStore } from '../store/menu'

const router = useRouter()
// console.log(router,'router')
const menuStore = useMenuStore()
const menuData = computed(() => menuStore.routerList)

//实现折叠和展开

//插值语法拿 pinia 里的state对象
//通过 computed 实时获取 Pinia 中的 isCollapse，并动态修改布局
const isCollapse = computed(() => menuStore.isCollapse)

//左侧保持高亮
const active = computed(() => menuStore.menuActive)

const handleOpen = () => {
    
}
const handleClose = () => {
    
}

</script>

<style lang="less" scoped>
.aside-container{
    height: 100%;
    .logo-lg{
        font-size: 20px;
        text-align: center;
        height: 50px;
        line-height: 50px;
        color: #fff;
    }
}


</style>